<?
/*
 * Copyright 2004-2005 Sigve Indregard.
 *
 * This file is part of Laivsys.
 *
 * Laivsys is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Laivsys is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Laivsys; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * $Id: deltakere-hyperion.php 6 2005-07-11 23:14:47Z say $
 */
 
include("../db.php");
include("auth.php");
header("Content-type: text/plain");

$alle = $_GET['alle'];
if ($alle != 'true') 
	$crit = " AND LaivID=$laivid";

$sql="SELECT Navn, Adresse, Postnrsted, YEAR(Fodselsdato) AS Fodselsaar, Telefon FROM Deltakere WHERE Godkjent=1$crit ORDER BY Navn";
$deltakere=mysql_query($sql);
//echo mysql_num_rows($deltakere);
//echo $sql;

while ($deltaker=mysql_fetch_assoc($deltakere)) {
	$navn = explode(" ", $deltaker['Navn']);
	$etternavn=$navn[sizeof($navn) - 1];
	$fornavn="";
	for ($i = -1; $i < sizeof($navn) - 1; $i++)
		$fornavn .= $navn[$i]." ";

	$fornavn=trim($fornavn);

	$adresse=$deltaker['Adresse'];
	$postnr=substr($deltaker['Postnrsted'], 0, 4);
	$aar = $deltaker['Fodselsaar'];
	$telefon=str_replace(" ", "", $deltaker['Telefon']);

	echo "$fornavn;$etternavn;$adresse;$postnr;$aar;$telefon\r\n";
}
?>
